﻿using FlowCanvas;
using FlowCanvas.Nodes;

namespace Yoozoo.Gameplay.Liberty.StreetEvent
{
    public class AddCounterValue : CallableActionNode<string, int>
    {
        private int counterValue;
        public override void Invoke(string counterName, int value)
        {
            counterName = counterName.Trim();
            StreetTaskCountUtils.AddValue(counterName, value);

            counterValue = StreetTaskCountUtils.GetValue(counterName);
        }

        protected override void OnRegisterExtraPorts(FlowNode node)
        {
            node.AddValueOutput<int>("counterValue", () =>
            {
                return counterValue;
            });
        }
    }
}